-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uniformize kwargs for Udop processor and update docs #33628
base: main
Are you sure you want to change the base?
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - left a few comments but all seems well
@@ -106,66 +142,44 @@ def __call__( | |||
if return_overflowing_tokens is True and return_offsets_mapping is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not, both args are boolean and cannot be None, right? could then be
if return_overflowing_tokens is True and return_offsets_mapping is False: | |
if return_overflowing_tokens and not return_offsets_mapping: |
boxes = output_kwargs["text_kwargs"].pop("boxes", None) | ||
word_labels = output_kwargs["text_kwargs"].pop("word_labels", None) | ||
text_pair = output_kwargs["text_kwargs"].pop("text_pair", None) | ||
return_overflowing_tokens = output_kwargs["text_kwargs"].get("return_overflowing_tokens", False) | ||
return_offsets_mapping = output_kwargs["text_kwargs"].get("return_offsets_mapping", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, lots of additional args here - but no way around it I suppose. Maybe we could group a bit by default values using iterators, for style and loc, but minor nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's not very nice... But grouping by default values and doing list comps is a bit hard to read here I feel like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for another great processor tidy up :)
verbose: bool = True, | ||
return_tensors: Optional[Union[str, TensorType]] = None, | ||
) -> BatchEncoding: | ||
# The following is to capture `text_pair` argument that may be passed as a positional argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V. good comment 💯
What does this PR do?
Adds uniformized processors kwargs following #31911 for Udop.
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@molbap @amyeroberts